<?php
namespace Home\Model;
use Think\Model;
class VerifyModel extends Model {
	//获取一条验证码
    public function getVerify(){
    		  //select * from verify order by rand() limit 1
        $sql = "select * from verify order by rand() limit 1";
        //此时$question为数组 0 => 数据库查询的内容
        $question = $this->query($sql);

        $question = current($question);
        //var_dump($question);
        //把随机到的问题答案存入SSSION
        $_SESSION['answer'] = $question['answer'];

        return $question['question'];
    }
}